package cn.gqr.mapper;

import cn.gqr.entity.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author gqr
 * @company null
 * @create 2022-06-12 17:08
 */
public interface OrderMapper extends BaseMapper<Order> {



    /**根据订单id添加快递单号**/
    int insertCourierNumberByOrderId(@Param("courierNumber") String courierNumber , @Param("orderId") Integer orderId);


    /**获取所有买家的订单信息和用户信息并且分页,可动态条件查询*/
    List<UserOrder> selectOrderHeaderAndUser(@Param("vo") UserOrderVO userOrderVO, @Param("start") int start, @Param("num") int num);


    /**所有买家的订单信息的总行数*/
    int selectOrderHeaderAndUserTotal(@Param("vo") UserOrderVO userOrderVO);


    /**根据订单id,查找订单明细的所有对应书本信息**/
    List<BookOrderDetail> selectBookOrderDetailsByOrderId(@Param("orderId") int orderId);


    /**获取当前登录用户的所有订单信息并且分页以及条件查询**/
    List<OrderInfo> selectUserOrderAllPage(@Param("userId") int userId,@Param("isPayment")Integer isPayment,@Param("startingTime")String startingTime, @Param("endTime")String endTime,@Param("start")int start,@Param("num")int num);

    /**获取当前登录用户的所有订单信息的总行数*/
    int selectUserOrderAllTotal(@Param("orderId") int orderId,@Param("isPayment")Integer isPayment,@Param("startingTime")String startingTime, @Param("endTime")String endTime);


    /**根据订单id更新付款状态**/
    int updatePaymentStatusByOrderId(Order order);

    /**根据订单id更新收货地址和收货电话**/
    int updateAddressAndPhoneByOrderId(Order order);


    /**添加订单明细**/
    int addOrderDetailsList(@Param("list") List<OrderDetail> orderDetails);

}
